import java.util.Scanner; class demo { public static void main(String args[]) { Scanner stdin=new Scanner(System.in); System.out.println("Enter 2 numbers :"); int a=stdin.nextInt(); int b=stdin.nextInt(); int m=a>b ? a:b; System.out.println("Greatest Number is "+m); } }
Enter 2 different Nos. 8 7 Greatest number is 8
import java.util.Scanner; class demo { public static void main(String args[]) { Scanner stdin=new Scanner(System.in); System.out.println("Enter 4 numbers :"); int a=stdin.nextInt(); int b=stdin.nextInt(); int c=stdin.nextInt(); int d=stdin.nextInt(); int x = a>b ? a:b; int y = c>d ? c:d; int z = x>y ? x:y; System.out.println("Greatest Number is "+z); } }
Enter 4 different Nos. 8 7 9 6 Greatest number is 9
HRA | BASIC | TA | BASIC | ITax | BASIC |
---|---|---|---|---|---|
5000 | >=10000 | 2000 | >=15000 | 2500 | >=20000 |
3000 | ⁢10000 | 1000 | ⁢15000 | 0 | ⁢20000 |
import java.util.Scanner; class demo { public static void main(String args[]) { Scanner stdin=new Scanner(System.in); System.out.println("Enter Basic :"); int basic=stdin.nextInt(); int hra = basic>10000 ? 5000:3000; int ta = basic>15000 ? 2000:1000; int itax = basic>20000 ? 2500:0; int netsal = basic+hra+ta–itax; System.out.println("Net Salary is "+netsal); } }
Enter Basic Salary: 17000 Net Salary is 24000